<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<ul class="list">
		</ul>
		<script src="cookie.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
		console.log(location.search);
		var da = location.search;
								var dat = da.slice(1);
								var xkl3 = new XMLHttpRequest();
						        var url =`http://jx.xuzhixiang.top/ap/api/detail.php?id=${dat}`;
						        xkl3.open('get',url);
						        xkl3.send(null);
							    xkl3.onload = function(){
							    if(xkl3.status == 200){
								console.log(xkl3.responseText);
								var obj = JSON.parse(xkl3.responseText);
								console.log(obj.data);							
						 var html = '';
						var productObj = obj.data;
						console.log(productObj);
						html += `
					<li>
						<a aid="${productObj.pid}" class='crf' href='productList.html?${productObj.pid}'><h2>${productObj.pname}</h2></a>
						<img src="${productObj.pimg}"/>
						<p>${productObj.pprice}</p>
						<input class='d-btn' aid="${productObj.aid}" type="button" value="加入购物车">
					</li>		
					`
					var list = document.querySelector('.list');
					list.innerHTML += html;
				}
			 }
				  
		</script>
	</body>
</html>
